object DMOddzialy: TDMOddzialy
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  Height = 208
  Width = 451
  object ADQOddzialy: TADQuery
    SQL.Strings = (
      'select D.*, '#39'nowa'#39' as stan, '#39'1'#39' as sort'
      'from OddzialyView D'
      'where D.inKRS = :krs'
      '  and D.pub_dodany = :pub'
      '  and D.data_dodany = :data'
      'union all'
      'select D.*, '#39'skasowana'#39' as stan, '#39'2'#39' as sort'
      'from OddzialyView D'
      'where D.inKRS = :krs'
      '  and D.pub_skasowany = :pub'
      '  and D.data_skasowany = :data'
      'union all'
      'select D.*, '#39'jest'#39' as stan, '#39'3'#39' as sort'
      'from OddzialyView D'
      'where D.inKRS = :krs'
      
        ' and (D.data_dodany < :data or (D.data_dodany = :data and D.pub_' +
        'dodany < :pub))'
      
        ' and ((D.data_skasowany > :data or (D.data_skasowany = :data and' +
        ' D.pub_skasowany > :pub)) '
      #9'  or '
      '      (D.pub_skasowany is null and D.data_skasowany is null)) '
      'order by sort, D.chNazwa')
    Left = 24
    Top = 16
    ParamData = <
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'KRS'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'DATA'
        ParamType = ptInput
      end
      item
        Name = 'PUB'
        ParamType = ptInput
      end>
  end
  object ADQDodajOddzial: TADQuery
    Left = 120
    Top = 16
  end
  object ADQUsunOddzialy: TADQuery
    Left = 120
    Top = 64
  end
  object ADQidNazwyOdzialu: TADQuery
    SQL.Strings = (
      'select idNazwyOddzialow '
      'from NazwyOddzialow '
      'where chNazwa = :nazwa')
    Left = 224
    Top = 16
    ParamData = <
      item
        Name = 'NAZWA'
        ParamType = ptInput
      end>
  end
  object ADQZapiszOddzialy: TADQuery
    Left = 120
    Top = 112
  end
  object ADQidAdresXMLOddzialu: TADQuery
    SQL.Strings = (
      'select * '
      'from AdresXML'
      'where chKraj = :kraj'
      '  and chJednostkaTerytorialna = :jednostka'
      '  and chWojewodztwo = :wojewodztwo'
      '  and chPowiat = :powiat'
      '  and chGmina = :gmina'
      '  and chMiejscowosc = :miejscowosc'
      '  and chPoczta = :poczta'
      '  and chKodPocztowy = :kod'
      '  and chUlica = :ulica'
      '  and chNumer = :numer'
      '  and chNumerLokalu = :numerLokalu')
    Left = 360
    Top = 17
    ParamData = <
      item
        Name = 'KRAJ'
        ParamType = ptInput
      end
      item
        Name = 'JEDNOSTKA'
        ParamType = ptInput
      end
      item
        Name = 'WOJEWODZTWO'
        ParamType = ptInput
      end
      item
        Name = 'POWIAT'
        ParamType = ptInput
      end
      item
        Name = 'GMINA'
        ParamType = ptInput
      end
      item
        Name = 'MIEJSCOWOSC'
        ParamType = ptInput
      end
      item
        Name = 'POCZTA'
        ParamType = ptInput
      end
      item
        Name = 'KOD'
        ParamType = ptInput
      end
      item
        Name = 'ULICA'
        ParamType = ptInput
      end
      item
        Name = 'NUMER'
        ParamType = ptInput
      end
      item
        Name = 'NUMERLOKALU'
        ParamType = ptInput
      end>
  end
end
